
<template>
  <div>
    <!-- 表格 -->
    <el-table :data="tableData.list" style="width: 100%">
      <el-table-column prop="id" label="订单编号" align="center">
      </el-table-column>
      <el-table-column label="下单时间" align="center">
        <template slot-scope="scope">
          {{ scope.row.orderTime |Femate }}
        </template>
      </el-table-column>
      <el-table-column label="总价" align="center">
        <template slot-scope="scope">
          ￥<span style="color: #e87180; font-size: 20px">{{
            scope.row.total
          }}</span
          >元</template
        >
      </el-table-column>
      <el-table-column prop="status" label="状态" align="center">
      </el-table-column>
      <el-table-column prop="customerId" label="顾客ID" align="center">
      </el-table-column>
      <el-table-column label="员工ID" align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.employeeId">{{ scope.row.employeeId }}</span>
          <span v-else>--</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-button
            type="text"
            style="color: #2cb5ac"
            @click="cli(scope)"
            size="small"
            >详情</el-button
          >
          <el-button
            type="text"
            style="color: #2cb5ac"
            @click="dispatch(scope)"
            size="small"
            >派单</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <div class="fenye">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="tableData.page"
        :page-sizes="[3, 5, 7]"
        :page-size="tableData.pageSize"
        layout="total, sizes, prev, pager, next"
        :total="tableData.total"
      >
      </el-pagination>
    </div>

    <!-- 模态框 -->
    <el-dialog title="派单" :visible.sync="dialogVisible">
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="sure">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import request from "../../utils/request";

export default {
  data() {
    return {
      queryParams: {
        page: 1,
        pageSize: 7,
      },
      // 订单数据
      tableData: {},
      dialogVisible: false,
    };
  },
  methods: {
    findOrder() {
      request
        .get("/order/pageQuery", {
          params: {
            page: this.queryParams.page,
            pageSize: this.queryParams.pageSize,
          },
        })
        .then((res) => {
          this.tableData = res.data;
        });
    },
    handleSizeChange(pageSize) {
      this.queryParams.pageSize = pageSize;
      this.findOrder();
    },
    handleCurrentChange(page) {
      this.queryParams.page = page;
      this.findOrder();
    },
    //点击确定
    sure() {},
    // 派单事件
    dispatch() {
      this.dialogVisible = true;
    },
  },
  created() {
    this.findOrder();
  },
};
</script>
<style  scoped>
.fenye{
  position: fixed;
  right: 50px;
}
</style>